# Maintainer: Jelle van der Waa <jelle@archlinux.org>

pkgname=arch-rebuild-order
pkgver=0.3.1
pkgrel=1
pkgdesc='CLI tool to determine the rebuild order of provided package(s)'
url='https://gitlab.archlinux.org/archlinux/arch-rebuild-order'
arch=('x86_64')
license=('MIT')
depends=('glibc' 'libalpm.so')
makedepends=('cargo' 'mandown' 'git')
groups=('archlinux-tools')
options=('debug')
source=(git+https://gitlab.archlinux.org/archlinux/arch-rebuild-order.git#tag=v$pkgver?signed)
sha512sums=('SKIP')
validpgpkeys=("E499C79F53C96A54E572FEE1C06086337C50773E")

prepare() {
  cd ${pkgname}
  cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
  cd ${pkgname}
  cargo build --frozen --release --all-features
}

check() {
  cd ${pkgname}
  cargo test --frozen --all-features
}

package() {
  cd ${pkgname}
  make install DESTDIR="$pkgdir" PREFIX=/usr

  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
